package com.bwie.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

/**
 * 商品表
 * @TableName t_product
 */
@TableName(value ="t_product")
@Document(indexName ="day3-12zk3",shards = 1,replicas = 1)
public class TProduct {
    /**
     * ID
     */
    @TableId(type = IdType.AUTO)
    @Id
    @Field(type = FieldType.Integer)
    private Integer id;

    /**
     * 商品编号
     */
    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String num;

    /**
     * 商品名称
     */
    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String name;

    /**
     * 商品分裂
     */
    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String type;

    /**
     * 商品价格
     */
    @Field(type = FieldType.Double)
    private Double price;

    /**
     * 商品介绍
     */
    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String introduce;

    /**
     * ID
     */
    public Integer getId() {
        return id;
    }

    /**
     * ID
     */
    public void setId(Integer id) {
        this.id = id;
    }

    /**
     * 商品编号
     */
    public String getNum() {
        return num;
    }

    /**
     * 商品编号
     */
    public void setNum(String num) {
        this.num = num;
    }

    /**
     * 商品名称
     */
    public String getName() {
        return name;
    }

    /**
     * 商品名称
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * 商品分裂
     */
    public String getType() {
        return type;
    }

    /**
     * 商品分裂
     */
    public void setType(String type) {
        this.type = type;
    }

    /**
     * 商品价格
     */
    public Double getPrice() {
        return price;
    }

    /**
     * 商品价格
     */
    public void setPrice(Double price) {
        this.price = price;
    }

    /**
     * 商品介绍
     */
    public String getIntroduce() {
        return introduce;
    }

    /**
     * 商品介绍
     */
    public void setIntroduce(String introduce) {
        this.introduce = introduce;
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        TProduct other = (TProduct) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getNum() == null ? other.getNum() == null : this.getNum().equals(other.getNum()))
            && (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
            && (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
            && (this.getPrice() == null ? other.getPrice() == null : this.getPrice().equals(other.getPrice()))
            && (this.getIntroduce() == null ? other.getIntroduce() == null : this.getIntroduce().equals(other.getIntroduce()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getNum() == null) ? 0 : getNum().hashCode());
        result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
        result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
        result = prime * result + ((getPrice() == null) ? 0 : getPrice().hashCode());
        result = prime * result + ((getIntroduce() == null) ? 0 : getIntroduce().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", num=").append(num);
        sb.append(", name=").append(name);
        sb.append(", type=").append(type);
        sb.append(", price=").append(price);
        sb.append(", introduce=").append(introduce);
        sb.append("]");
        return sb.toString();
    }
}